{include file="head" /}

{include file="menu" /}


<!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              
            
          <div class="row">
                  <div class="col-sm-12">
                      <aside class="profile-info col-lg-10">
                      <section class="panel">
                          
                          <div class="panel-body bio-graph-info">
                              <h1> {$pid?'编辑产品':'添加产品'}</h1>
                              <form class="form-horizontal" role="form" id="formid" method="post">
                                  
                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">产品名称</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control" value="{$ptitle?$ptitle:''}"  placeholder="请填写产品名称" name="ptitle">
                                      </div>
                                  </div>


                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">分类</label>
                                      <div class="col-lg-8">
                                          <select name="cid" class="selectpicker show-tick form-control">
                                          		<option value="0">请选择分类</option>
                                          		<!-- {volist name="proclass" id="vo"} -->
                                            	<option {if isset($cid) && $cid == $vo['pcid']} selected="selected" {/if} value="{$vo.pcid}">{$vo.pcname}</option>
                                              	<!-- {/volist} -->
                                          </select>
                                      </div>
                                  </div>

                                  
							
                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">风控波动范围</label>
                                      <div class="col-lg-8">
                                      		<div class="input-group">
					                            <span class="input-group-addon" id="basic-addon1">最小值</span>
					                            <input type="text" value="{$point_low?$point_low:''}" class="form-control" placeholder="风控波动最小值" name="point_low">
					                            <span class="input-group-addon" id="basic-addon1">最大值</span>
					                            <input type="text" value="{$point_top?$point_top:''}" class="form-control" placeholder="风控波动最大值" name="point_top">
					                        </div>
					                        
											<div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
				                                 <strong>注意：</strong> 客户订单在条件范围内时，会根据订单的涨或跌，自动减或加最小值与最大值之间的随机数，留空或者0则为不开启
				                            </div>
					                        
                                          
                                      </div>
                                  </div>

                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">随机波动范围</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control"  placeholder="请填写随机波动范围" name="rands" value="{$rands?$rands:''}">
                                          <div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
				                                 <strong>注意：</strong> 产品获取接口值后，会加上+-此处的值。如5，则在接口获取的数据中加上-5~5之间的随机数。
				                          </div>
                                      </div>
                                  </div>

                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">产品代码</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control" value="{$procode?$procode:''}"  placeholder="请填写产品代码" name="procode">
                                      </div>
                                  </div>
<!-- 
                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">除汇率以外算得的值</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control" value="{$add_data?$add_data:''}"  placeholder="请填写产品名称" name="add_data">
                                          <div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
                                               <strong>注意：</strong> 除汇率意外算得的值，产品实时价格 = 产品原本价格 * 汇率 * 其他；这里应输入“其他”；最多保留四位小数。
                                        </div>
                                      </div>
                                  </div> -->

                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">时间玩法间隔</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control" value="{$protime?$protime:''}"  placeholder="请填写时间玩法间隔" name="protime">
                                          <div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
                                               <strong>注意：</strong> 如时间为：1分、3分、5分、8分，则请用字母逗号将时间分开，如输入：1,3,5,8。如没有此玩法则留空。必须为四个
                                        </div>
                                      </div>
                                  </div>

<!--                                   <div class="form-group">
                                      <label class="col-lg-2 control-label">点位玩法间隔</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control" value="{$propoint?$propoint:''}"  placeholder="请填写产品名称" name="propoint">
                                          <div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
                                               <strong>注意：</strong> 如点位为：1点、3点、5点、8点，则请用字母逗号将点位分开，如输入：1,3,5,8。如没有此玩法则留空。必须为四个
                                        </div>
                                      </div>
                                  </div> -->

                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">盈亏比例</label>
                                      <div class="col-lg-8">
                                          <input type="text" class="form-control" value="{$proscale?$proscale:''}"  placeholder="请填写盈亏比例" name="proscale">
                                          <div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
                                               <strong>注意：</strong> 如比例为：75%、77%，80%、85%，则请用字母逗号将比例分开，如输入：75,77,80,85。必须为四个，且不得为空
                                        </div>
                                      </div>
                                  </div>

                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">开市时间</label>
                                      <div class="col-lg-8">
                                          <div class="input-group">
                                              <span class="input-group-addon" id="basic-addon1">周一</span>
                                              <input type="text" value="{$opentime[0]?$opentime[0]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[1]">
                                              <span class="input-group-addon" id="basic-addon1">周二</span>
                                              <input type="text" value="{$opentime[1]?$opentime[1]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[2]">
                                          </div>

                                          <div class="input-group">
                                              <span class="input-group-addon" id="basic-addon1">周三</span>
                                              <input type="text" value="{$opentime[2]?$opentime[2]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[3]">
                                              <span class="input-group-addon" id="basic-addon1">周四</span>
                                              <input type="text" value="{$opentime[3]?$opentime[3]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[4]">
                                          </div>

                                          <div class="input-group">
                                              <span class="input-group-addon" id="basic-addon1">周五</span>
                                              <input type="text" value="{$opentime[4]?$opentime[4]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[5]">
                                              <span class="input-group-addon" id="basic-addon1">周六</span>
                                              <input type="text" value="{$opentime[5]?$opentime[5]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[6]">
                                              <span class="input-group-addon" id="basic-addon1">周日</span>
                                              <input type="text" value="{$opentime[6]?$opentime[6]:''}" class="form-control" placeholder="如：00:00~03:00|08:00~24:00" name="opentime[7]">
                                          </div>


                                  
                                    <div class="alert alert-block alert-danger fade in" style="margin:10px 0 0 0 ">
                                         <strong>注意：</strong> 开市时间为00:00~18:00则输入 00:00~18:00  开市时间为00:00~03:00 和 08:00~24:00;则输入 如：00:00~03:00|08:00~24:00 不得出现中文符号，全天不开市请留空,时间一定要填写准确
                                    </div>
                                  
                                          
                                      </div>
                                  </div>
                                  
                                  <div class="form-group">
                                      <label class="col-lg-2 control-label">备注</label>
                                      <div class="col-lg-8">
                                          <textarea name="content" class="form-control" cols="30" rows="10">{$content?$content:''}</textarea>
                                      </div>
                                  </div>
								
								<input type="hidden" name="pid" value="{$pid?$pid:''}">
                                  <div class="form-group">
                                      <div class="col-lg-offset-2 col-lg-10">
                                          <input type="submit" class="btn btn-success" onclick="return editpro(this.form)" value="提交">
                                          
                                      </div>
                                  </div>
                              </form>
                          </div>
                      </section>
                      
                  </aside>
                  </div>

          </div>       
          
          
             

          </section>
      </section>
      <!--main content end-->
  </section>


{include file="foot" /}
<script>

function editpro(form){

	var ptitle = form.ptitle.value;
	var cid = form.cid.value;
	var point_low = form.point_low.value;
	var point_top = form.point_top.value;
	var rands = form.rands.value;
  var procode = form.procode.value;
  var proscale = form.proscale.value;

	if(!ptitle){
		layer.msg('请输入产品名称'); 
	    return false;
	}

	if(!cid || cid == 0){
		layer.msg('请选择分类'); 
	    return false;
	}



	if(point_low < 0 || isNaN(point_low) || point_top < 0 || isNaN(point_top) || rands < 0 || isNaN(rands)){
		layer.msg('风控值应为大于0的数字'); 
	    return false;
	}

	if(point_low > point_top ){
		layer.msg('风控最小值应该小于最大值'); 
	    return false;
	}

  if(!procode ){
    layer.msg('请输入产品代码！'); 
      return false;
  }

  if(!proscale ){
    layer.msg('请输入盈亏比例！'); 
      return false;
  }




	var formurl = "{:Url('goods/proadd')}"
    var data = $('#formid').serialize();
    var locurl = "{:Url('admin/goods/prolist')}";

    WPpost(formurl,data,locurl);




	return false;

}


</script>